package com.mx.kn.cstf2.dao.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import kn.cstf2.transition.Bean.PersonalBean;
import kn.cstf2.transition.Bean.TransitionBean;





import com.mx.kn.cstf2.dao.MailDao;
import com.mx.kn.cstf2.dto.CopContactsDto;
import com.mx.kn.cstf2.utils.MailSender;
@Repository
@Component("mailDao")
public class MailDaoImpl implements MailDao{

	@Override
	public void sendNotifyStatusMail(TransitionBean transitionBean,ArrayList<String> mails){
//		ArrayList<String> mails = new ArrayList<String>();
//		mails.add("bryan.elizalde07@gmail.com");
		MailSender.sendEmail(mails, "si", transitionBean.toString());
		
	}

	@Override
	public void sendNotifyPersonsGrid(ArrayList<PersonalBean> transisition) {
		// TODO Auto-generated method stub
		
		ArrayList<String> mails = new ArrayList<String>();
		
		for(PersonalBean personas:transisition){
				mails.add(personas.getEmail());	
		}		
		MailSender.sendEmail(mails, "si", transisition.toString());
		
	}

	@Override
	public void sendNotifyContactsCop(List<CopContactsDto> copMails) {
		ArrayList<String> mails = new ArrayList<String>();
		
		for(CopContactsDto mailsToSend:copMails){
			mails.add(mailsToSend.getEmail());
		}
		
		MailSender.sendEmail(mails, "COP NotifyStatus", "Se realizó un envio de notificación COP");
		
	}
	
}
